package com.hzlj.position.locate.converter;

import com.fz.common.base.converter.ModelDTOConverter;
import com.fz.common.base.core.date.DateUtils;
import com.hzlj.position.locate.common.dto.positionSkynet.PositionSkynetAddDTO;
import com.hzlj.position.locate.common.dto.positionSkynet.PositionSkynetQueryResultDTO;
import com.hzlj.position.locate.common.model.PositionSkynet;

/**
 * 定位记录-天网(PositionSkynet)DTO转换类
 *
 * @author lifh
 * @date 2023-03-31 11:05:36
 */
public class PositionSkynetConverter {
    /**
     * model实例转换为查询结果DTO
     *
     * @param model model实例
     * @return DTO
     */
    public static PositionSkynetQueryResultDTO from(PositionSkynet model) {
        return ModelDTOConverter.from(model, PositionSkynetQueryResultDTO.class);
    }

    /**
     * 新增DTO转换为model实例
     *
     * @param dto 新增DTO
     * @return model实例
     */
    public static PositionSkynet from(PositionSkynetAddDTO dto) {
        return ModelDTOConverter.from(dto, PositionSkynet.class, (PositionSkynet l) -> {
            l.setUpdateTime(DateUtils.now());
            l.setCreateTime(DateUtils.now());
        });

    }
}
